﻿
using System;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using MedicWeb.MedicService;

namespace MedicWeb.forms {
    public class SessionPage : System.Web.UI.Page, IRequiresSessionState {

        static public readonly string SessionKey = "UserSession";

        protected MedicWeb.MedicService.Session GetSession() {
            HttpSessionState httpSessionState = Session;
            return (MedicWeb.MedicService.Session)Session[SessionKey];
        }

        protected TableCell createDeleteCell(Entity entity) {
            var cellDelete = new TableCell();
            cellDelete.Width = 24;
            cellDelete.Controls.Add(new HyperLink() {
                CssClass = "delete entity",
                NavigateUrl = ResolveUrl("~/forms/Delete.aspx?id=" + entity.Id + "&class=" + entity.GetType().Name)
            });
            return cellDelete;
        }

    }


}